import { createGlobalState, useStorage } from '@vueuse/core'
import { computed, ref } from 'vue'

export const useGlobalState = createGlobalState(
    // () => useStorage('vueuse-local-storage', 'initialValue'),
    () => {
        // state
        const count = ref(0)
    
        // getters
        const doubleCount = computed(() => count.value * 2)
    
        // actions
        function increment() {
          count.value++
        }
    
        return { count, doubleCount, increment }
      }
  )